import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '主页', icon: 'yemian-copy' }
    }]
  },
  {
    path: '/mapmng',
    component: Layout,
    children: [
      {
        path: 'mapmng',
        name: 'mapmng',
        component: () => import('@/views/mapmng'),
        meta: { title: '电子地图管理', icon: 'ditu' }
      }
    ]
  },

  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    name: 'Example',
    meta: { title: '信息采集管理', icon: 'zhibanguanli' },
    children: [
      {
        path: 'parkingmng',
        name: 'parkingmng',
        component: () => import('@/views/parkingmng'),
        meta: { title: '停车场管理' }
      },
      {
        path: 'personinfomng',
        name: 'personinfomng',
        component: () => import('@/views/personinfomng'),
        meta: { title: '人员信息管理' }
      },
      {
        path: 'equipmentmng',
        name: 'equipmentmng',
        component: () => import('@/views/equipmentmng'),
        meta: { title: '停车场设备信息管理' }
      },
      {
        path: 'fireequipmng',
        name: 'fireequipmng',
        component: () => import('@/views/fireequipmng'),
        meta: { title: '消防设备信息管理' }
      },
      {
        path: 'vehicleaccess',
        name: 'vehicleaccess',
        component: () => import('@/views/vehicleaccess'),
        meta: { title: '车辆出入信息管理' }
      },
      {
        path: 'scheduling',
        component: () => import('@/components/CommonRouterView/index'), // Parent router-view
        name: 'scheduling',
        meta: { title: '值班管理' },
        children: [
          {
            path: 'schedulingmng',
            component: () => import('@/views/scheduling/schedulingmng'),
            name: 'schedulingmng',
            meta: { title: '值班排班' }
          },
          {
            path: 'schedulinglog',
            component: () => import('@/views/scheduling/schedulinglog'),
            name: 'schedulinglog',
            meta: { title: '值班日志' }
          }
        ]
      }
    ]
  },
  {
    path: '/videosurveillance',
    component: Layout,
    redirect: '/videosurveillance/table',
    name: 'videosurveillance',
    meta: { title: '视频监控', icon: 'shipinjiankong' },
    children: [
      {
        path: '/videosurveillance/parkinglot1',
        name: 'parkinglot1',
        component: () => import('@/components/CommonRouterView/index'),
        meta: { title: '停车场1' },
        children: [
          {
            path: '/videosurveillance/parkinglot1/camera/1-1',
            component: () => import('@/views/videosurveillance/parkinglot/camera'),
            name: 'Camera1-1',
            meta: { title: '摄像头1' }
          },
          {
            path: '/videosurveillance/parkinglot1/camera/1-2',
            component: () => import('@/views/videosurveillance/parkinglot/camera'),
            name: 'Camera1-2',
            meta: { title: '摄像头2' }
          },
          {
            path: '/videosurveillance/parkinglot1/camera/1-3',
            component: () => import('@/views/videosurveillance/parkinglot/camera'),
            name: 'Camera1-3',
            meta: { title: '摄像头3' }
          },
          {
            path: '/videosurveillance/parkinglot1/camera/1-4',
            component: () => import('@/views/videosurveillance/parkinglot/camera'),
            name: 'Camera1-4',
            meta: { title: '摄像头4' }
          }
        ]
      },
      {
        path: '/videosurveillance/parkinglot2',
        name: 'parkinglot2',
        component: () => import('@/components/CommonRouterView/index'),
        meta: { title: '停车场2' },
        children: [
          {
            path: '/videosurveillance/parkinglot2/camera/2-1',
            component: () => import('@/views/videosurveillance/parkinglot/camera'),
            name: 'Camera2-1',
            meta: { title: '摄像头1' }
          },
          {
            path: 'park2-2',
            component: () => import('@/views/404'),
            name: 'park2-2',
            meta: { title: '摄像头2' }
          },
          {
            path: 'park2-3',
            component: () => import('@/views/404'),
            name: 'park2-3',
            meta: { title: '摄像头3' }
          },
          {
            path: 'park2-4',
            component: () => import('@/views/404'),
            name: 'park2-4',
            meta: { title: '摄像头4' }
          }
        ]
      },
      {
        path: 'park3',
        name: 'park3',
        component: () => import('@/views/equipmentmng'),
        meta: { title: '停车场3' },
        children: [
          {
            path: 'park3-1',
            component: () => import('@/views/404'),
            name: 'park3-1',
            meta: { title: '摄像头1' }
          },
          {
            path: 'park3-2',
            component: () => import('@/views/404'),
            name: 'park3-2',
            meta: { title: '摄像头2' }
          },
          {
            path: 'park3-3',
            component: () => import('@/views/404'),
            name: 'park3-3',
            meta: { title: '摄像头3' }
          },
          {
            path: 'park3-4',
            component: () => import('@/views/404'),
            name: 'park3-4',
            meta: { title: '摄像头4' }
          }
        ]
      },
      {
        path: 'park4',
        name: 'park4',
        component: () => import('@/views/404'),
        meta: { title: '停车场4' },
        children: [
          {
            path: 'park4-1',
            component: () => import('@/views/404'),
            name: 'park4-1',
            meta: { title: '摄像头1' }
          },
          {
            path: 'park4-2',
            component: () => import('@/views/404'),
            name: 'park4-2',
            meta: { title: '摄像头2' }
          },
          {
            path: 'park4-3',
            component: () => import('@/views/404'),
            name: 'park4-3',
            meta: { title: '摄像头3' }
          },
          {
            path: 'park4-4',
            component: () => import('@/views/404'),
            name: 'park4-4',
            meta: { title: '摄像头4' }
          }
        ]
      },
      {
        path: 'park5',
        name: 'park5',
        component: () => import('@/views/404'),
        meta: { title: '停车场5' },
        children: [
          {
            path: 'park5-1',
            component: () => import('@/views/404'),
            name: 'park5-1',
            meta: { title: '摄像头1' }
          },
          {
            path: 'park5-2',
            component: () => import('@/views/404'),
            name: 'park5-2',
            meta: { title: '摄像头2' }
          },
          {
            path: 'park5-3',
            component: () => import('@/views/404'),
            name: 'park5-3',
            meta: { title: '摄像头3' }
          },
          {
            path: 'park5-4',
            component: () => import('@/views/404'),
            name: 'park5-4',
            meta: { title: '摄像头4' }
          }
        ]
      },
      {
        path: 'park6',
        component: () => import('@/views/404'), // Parent router-view
        name: 'park6',
        meta: { title: '停车场6' },
        children: [
          {
            path: 'park6-1',
            component: () => import('@/views/404'),
            name: 'park6-1',
            meta: { title: '摄像头1' }
          },
          {
            path: 'park6-2',
            component: () => import('@/views/404'),
            name: 'park6-2',
            meta: { title: '摄像头2' }
          },
          {
            path: 'park6-3',
            component: () => import('@/views/404'),
            name: 'park6-3',
            meta: { title: '摄像头3' }
          },
          {
            path: 'park6-4',
            component: () => import('@/views/404'),
            name: 'park6-4',
            meta: { title: '摄像头4' }
          }
        ]
      }
    ]
  },
  {
    path: '/example1',
    component: Layout,
    redirect: '/example1/table6',
    name: 'Example1',
    meta: { title: '设备安全监控', icon: 'shipin' },
    children: [
      {
        path: '/devicestate',
        name: 'devicestate',
        component: () => import('@/views/devicestate'),
        meta: { title: '设备状态查询' }
      },
      {
        path: '/devicefault',
        name: 'devicefault',
        component: () => import('@/views/devicefault'),
        meta: { title: '设备故障管理' }
      },
      {
        path: '/devicerepair',
        name: 'devicerepair',
        component: () => import('@/views/devicerepair'),
        meta: { title: '设备检修管理' }
      }
    ]
  },
  {
    path: '/example2',
    component: Layout,
    redirect: '/example/tables',
    name: 'Example2',
    meta: { title: '报警应急处置', icon: 'baojing' },
    children: [
      {
        path: '/tablet',
        name: 'Tablet',
        component: () => import('@/views/alarmrec'),
        meta: { title: '实时报警接收' }
      },
      {
        path: '/tablem',
        name: 'Tablem',
        component: () => import('@/views/alarmingmng'),
        meta: { title: '历史报警管理' }
      },
      {
        path: '/tablec',
        name: 'Table',
        component: () => import('@/views/planmng'),
        meta: { title: '报警预案编制' }
      }

    ]
  },
  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
